Generated by Cython 3.0.2

Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.

Raw output: decorr.c

+001: # cython: infer_types=True, wraparound=False, nonecheck=False, boundscheck=False, cdivision=True, language_level=3, profile=False, autogen_pxd=True
  __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 002: 
+003: from math import cos, fabs, sqrt
  __pyx_t_7 = PyList_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_cos);
  __Pyx_GIVEREF(__pyx_n_s_cos);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_cos)) __PYX_ERR(0, 3, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_s_fabs);
  __Pyx_GIVEREF(__pyx_n_s_fabs);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_fabs)) __PYX_ERR(0, 3, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_s_sqrt);
  __Pyx_GIVEREF(__pyx_n_s_sqrt);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_sqrt)) __PYX_ERR(0, 3, __pyx_L1_error);
  __pyx_t_4 = __Pyx_Import(__pyx_n_s_math, __pyx_t_7, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cos, __pyx_t_7) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_fabs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fabs, __pyx_t_7) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sqrt, __pyx_t_7) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 004: 
+005: import io
  __pyx_t_4 = __Pyx_ImportDottedModule(__pyx_n_s_io, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_4) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+006: import numpy as np
  __pyx_t_4 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_4) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+007: from matplotlib import pyplot as plt
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_n_s_pyplot);
  __Pyx_GIVEREF(__pyx_n_s_pyplot);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_pyplot)) __PYX_ERR(0, 7, __pyx_L1_error);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_matplotlib, __pyx_t_4, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_pyplot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_plt, __pyx_t_4) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+008: from scipy.ndimage import gaussian_filter
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_gaussian_filter);
  __Pyx_GIVEREF(__pyx_n_s_gaussian_filter);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_gaussian_filter)) __PYX_ERR(0, 8, __pyx_L1_error);
  __pyx_t_4 = __Pyx_Import(__pyx_n_s_scipy_ndimage, __pyx_t_7, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_gaussian_filter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gaussian_filter, __pyx_t_7) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 009: 
+010: from ..utils.timeit import timeit2
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_n_s_timeit2);
  __Pyx_GIVEREF(__pyx_n_s_timeit2);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_timeit2)) __PYX_ERR(0, 10, __pyx_L1_error);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_utils_timeit, __pyx_t_4, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_timeit2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_timeit2, __pyx_t_4) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 011: 
 012: cimport numpy as np
 013: from libc.math cimport ceil, exp, fmax, fmin, isnan, log, pow, round, sqrt
 014: 
 015: from cython.parallel import prange
 016: 
 017: from ..generate.mask cimport _get_circular_mask
 018: from ..transform.edges cimport _apodize_edges
 019: from ..transform.normalize cimport _normalizeFFT
 020: from ..utils.array cimport _get_max, _get_min
 021: 
 022: 
+023: cdef class DecorrAnalysis:
struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis {
  __Pyx_memviewslice (*_get_preprocessed_image)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, PyObject *);
  float (*_linmap)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, float, float, float, float, float);
  float (*_get_corr_coef_norm)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice);
  __Pyx_memviewslice (*_get_best_score)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, __Pyx_memviewslice, __Pyx_memviewslice);
  __Pyx_memviewslice (*_get_max_score)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, __Pyx_memviewslice, __Pyx_memviewslice);
  __Pyx_memviewslice (*_get_corr_coef_ring)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, float, float);
  __Pyx_memviewslice (*_compute_d0)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, __Pyx_memviewslice, __Pyx_memviewslice);
  __Pyx_memviewslice (*_get_d_corr_max)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *, __Pyx_memviewslice, float, float);
  __Pyx_memviewslice (*_compute_d)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *);
  PyObject *(*_run_analysis)(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *);
};
static struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_vtabptr_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis;

 024: 
 025:     # autogen_pxd: cdef float[:] d0, kc, a_g
 026:     # autogen_pxd: cdef float[:, :] img, img_ref, d
 027:     # autogen_pxd: cdef float rmin, rmin2, rmax, rmax2, kc0, a0, kc_gm, agm, kc_max, a_max, pixel_size
 028:     # autogen_pxd: cdef public float resolution
 029:     # autogen_pxd: cdef int n_r, n_g, x0, x1, y0, y1
 030:     # autogen_pxd: cdef bint do_plot
 031:     # autogen_pxd: cdef str units
 032: 
+033:     def __init__(self, rmin:float = 0, rmax:float = 1, n_r:int = 50, n_g:int =10, pixel_size: float = 1, units: str = "pixel", roi: tuple = (0, 0, 0, 0), do_plot: bool = False):
/* Python wrapper */
static int __pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis___init__, "_summary_\n\n        Args:\n            rmin (float, optional): Minimum radius [0,rMax] (normalized frequencies) used for decorrelation analysis. Defaults to 0.\n            rmax (float, optional): Maximum radius [rMin,1] (normalized frequencies) used for decorrelation analysis. Defaults to 1.\n            n_r (int, optional): [10,100], Sampling of decorrelation curve. Defaults to 50.\n            n_g (int, optional): [5,40], Number of high-pass image analyzed. Defaults to 10.\n            pixel_size (int, optional): > 1, pixel size value in units. Defaults to 1.\n            units (str, optional): string name of the units to use. Defaults to \"pixel\".\n            roi (tuple, optional): Coordinates used to crop the image (x0, y0, x1, y1). Defaults to None.\n            do_plot (bool, optional): Defaults to False.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis___init__;
#endif
static int __pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_rmin;
  double __pyx_v_rmax;
  PyObject *__pyx_v_n_r = 0;
  PyObject *__pyx_v_n_g = 0;
  double __pyx_v_pixel_size;
  PyObject *__pyx_v_units = 0;
  PyObject *__pyx_v_roi = 0;
  PyObject *__pyx_v_do_plot = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args);
  if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 33, __pyx_L3_error)
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rmin,&__pyx_n_s_rmax,&__pyx_n_s_n_r,&__pyx_n_s_n_g,&__pyx_n_s_pixel_size,&__pyx_n_s_units,&__pyx_n_s_roi,&__pyx_n_s_do_plot,0};
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[2] = __Pyx_Arg_NewRef_VARARGS(__pyx_k__11);
    values[3] = __Pyx_Arg_NewRef_VARARGS(__pyx_k__12);
    values[5] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)__pyx_n_u_pixel));
    values[6] = __Pyx_Arg_NewRef_VARARGS(((PyObject*)__pyx_tuple__13));
    values[7] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  8: values[7] = __Pyx_Arg_VARARGS(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_VARARGS(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rmin);
          if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rmax);
          if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_r);
          if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_g);
          if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pixel_size);
          if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_units);
          if (value) { values[5] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_roi);
          if (value) { values[6] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_do_plot);
          if (value) { values[7] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 33, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  8: values[7] = __Pyx_Arg_VARARGS(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_VARARGS(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_VARARGS(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_rmin = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rmin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
    } else {
      __pyx_v_rmin = ((double)0.0);
    }
    if (values[1]) {
      __pyx_v_rmax = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_rmax == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
    } else {
      __pyx_v_rmax = ((double)1.0);
    }
    __pyx_v_n_r = ((PyObject*)values[2]);
    __pyx_v_n_g = ((PyObject*)values[3]);
    if (values[4]) {
      __pyx_v_pixel_size = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_pixel_size == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
    } else {
      __pyx_v_pixel_size = ((double)1.0);
    }
    __pyx_v_units = ((PyObject*)values[5]);
    __pyx_v_roi = ((PyObject*)values[6]);
    __pyx_v_do_plot = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 8, __pyx_nargs); __PYX_ERR(0, 33, __pyx_L3_error)
  goto __pyx_L3_error;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n_r), (&PyInt_Type), 0, "n_r", 1))) __PYX_ERR(0, 33, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n_g), (&PyInt_Type), 0, "n_g", 1))) __PYX_ERR(0, 33, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_units), (&PyUnicode_Type), 0, "units", 1))) __PYX_ERR(0, 33, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_roi), (&PyTuple_Type), 0, "roi", 1))) __PYX_ERR(0, 33, __pyx_L1_error)
  __pyx_r = __pyx_pf_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis___init__(((struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self), __pyx_v_rmin, __pyx_v_rmax, __pyx_v_n_r, __pyx_v_n_g, __pyx_v_pixel_size, __pyx_v_units, __pyx_v_roi, __pyx_v_do_plot);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis___init__(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, double __pyx_v_rmin, double __pyx_v_rmax, PyObject *__pyx_v_n_r, PyObject *__pyx_v_n_g, double __pyx_v_pixel_size, PyObject *__pyx_v_units, PyObject *__pyx_v_roi, PyObject *__pyx_v_do_plot) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
/* … */
  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_13);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_14, 1);
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__13 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
/* … */
  if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_50)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_50))) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_INCREF(__pyx_int_50);
  __pyx_k__11 = ((PyObject*)__pyx_int_50);
  __Pyx_GIVEREF(__pyx_int_50);
  if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_10)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_10))) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_INCREF(__pyx_int_10);
  __pyx_k__12 = ((PyObject*)__pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
 034:         """_summary_
 035: 
 036:         Args:
 037:             rmin (float, optional): Minimum radius [0,rMax] (normalized frequencies) used for decorrelation analysis. Defaults to 0.
 038:             rmax (float, optional): Maximum radius [rMin,1] (normalized frequencies) used for decorrelation analysis. Defaults to 1.
 039:             n_r (int, optional): [10,100], Sampling of decorrelation curve. Defaults to 50.
 040:             n_g (int, optional): [5,40], Number of high-pass image analyzed. Defaults to 10.
 041:             pixel_size (int, optional): > 1, pixel size value in units. Defaults to 1.
 042:             units (str, optional): string name of the units to use. Defaults to "pixel".
 043:             roi (tuple, optional): Coordinates used to crop the image (x0, y0, x1, y1). Defaults to None.
 044:             do_plot (bool, optional): Defaults to False.
 045:         """
+046:         self.img = None
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 46, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->img, 0);
  __pyx_v_self->img = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
+047:         self.img_ref = None
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 47, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->img_ref, 0);
  __pyx_v_self->img_ref = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
+048:         self.rmin, self.rmin2 = rmin, rmin
  __pyx_t_2 = __pyx_v_rmin;
  __pyx_t_3 = __pyx_v_rmin;
  __pyx_v_self->rmin = __pyx_t_2;
  __pyx_v_self->rmin2 = __pyx_t_3;
+049:         self.rmax, self.rmax2 = rmax, rmax
  __pyx_t_3 = __pyx_v_rmax;
  __pyx_t_2 = __pyx_v_rmax;
  __pyx_v_self->rmax = __pyx_t_3;
  __pyx_v_self->rmax2 = __pyx_t_2;
+050:         self.n_r = n_r
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_n_r); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L1_error)
  __pyx_v_self->n_r = __pyx_t_4;
+051:         self.n_g = n_g
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_n_g); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L1_error)
  __pyx_v_self->n_g = __pyx_t_4;
+052:         self.pixel_size = pixel_size
  __pyx_v_self->pixel_size = __pyx_v_pixel_size;
+053:         self.units = units
  __Pyx_INCREF(__pyx_v_units);
  __Pyx_GIVEREF(__pyx_v_units);
  __Pyx_GOTREF(__pyx_v_self->units);
  __Pyx_DECREF(__pyx_v_self->units);
  __pyx_v_self->units = __pyx_v_units;
+054:         self.x0, self.x1, self.y0, self.y1 = roi
  if (1) {
    PyObject* sequence = __pyx_v_roi;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 54, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 54, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
  }
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_self->x0 = __pyx_t_4;
  __pyx_v_self->x1 = __pyx_t_9;
  __pyx_v_self->y0 = __pyx_t_10;
  __pyx_v_self->y1 = __pyx_t_11;
+055:         self.do_plot = do_plot
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_do_plot); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error)
  __pyx_v_self->do_plot = __pyx_t_12;
+056:         self.d0 = np.zeros((self.n_r), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_13) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->d0, 0);
  __pyx_v_self->d0 = __pyx_t_14;
  __pyx_t_14.memview = NULL;
  __pyx_t_14.data = NULL;
+057:         self.d = np.zeros((self.n_r, 2*self.n_g), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_6 = __Pyx_PyInt_From_long((2 * __pyx_v_self->n_g)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_13);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_13)) __PYX_ERR(0, 57, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error);
  __pyx_t_13 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7)) __PYX_ERR(0, 57, __pyx_L1_error);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->d, 0);
  __pyx_v_self->d = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
+058:         self.kc = np.zeros((2*self.n_g), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_long((2 * __pyx_v_self->n_g)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_13) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->kc, 0);
  __pyx_v_self->kc = __pyx_t_14;
  __pyx_t_14.memview = NULL;
  __pyx_t_14.data = NULL;
+059:         self.a_g = np.zeros((2*self.n_g), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyInt_From_long((2 * __pyx_v_self->n_g)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_13);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_13)) __PYX_ERR(0, 59, __pyx_L1_error);
  __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->a_g, 0);
  __pyx_v_self->a_g = __pyx_t_14;
  __pyx_t_14.memview = NULL;
  __pyx_t_14.data = NULL;
+060:         self.kc0 = 0
  __pyx_v_self->kc0 = 0.0;
+061:         self.a0 = 0
  __pyx_v_self->a0 = 0.0;
+062:         self.kc_gm = 0
  __pyx_v_self->kc_gm = 0.0;
+063:         self.agm = 0
  __pyx_v_self->agm = 0.0;
+064:         self.kc_max = 0
  __pyx_v_self->kc_max = 0.0;
+065:         self.a_max = 0
  __pyx_v_self->a_max = 0.0;
+066:         self.resolution = 0
  __pyx_v_self->resolution = 0.0;
+067:         self.units = units
  __Pyx_INCREF(__pyx_v_units);
  __Pyx_GIVEREF(__pyx_v_units);
  __Pyx_GOTREF(__pyx_v_self->units);
  __Pyx_DECREF(__pyx_v_self->units);
  __pyx_v_self->units = __pyx_v_units;
 068: 
 069:     # @timeit2
+070:     def run_analysis(self,  img: np.ndarray):
/* Python wrapper */
static PyObject *__pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_3run_analysis(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_2run_analysis, "\n        Method used to run the analysis. Starting parameters are defined on class instance initialization.\n        Args:\n            img (np.ndarray): image to analyze\n        ");
static PyMethodDef __pyx_mdef_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_3run_analysis = {"run_analysis", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_3run_analysis, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_2run_analysis};
static PyObject *__pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_3run_analysis(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_img = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_analysis (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args);
  if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 70, __pyx_L3_error)
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_img,0};
  PyObject* values[1] = {0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_img)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "run_analysis") < 0)) __PYX_ERR(0, 70, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_img = ((PyArrayObject *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("run_analysis", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 70, __pyx_L3_error)
  goto __pyx_L3_error;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis.run_analysis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_img), __pyx_ptype_5numpy_ndarray, 0, "img", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
  __pyx_r = __pyx_pf_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_2run_analysis(((struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self), __pyx_v_img);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_2run_analysis(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, PyArrayObject *__pyx_v_img) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_analysis", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis.run_analysis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_img); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
/* … */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_img, __pyx_kp_s_np_ndarray) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_3run_analysis, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DecorrAnalysis_run_analysis, NULL, __pyx_n_s_nanopyx_core_analysis_decorr, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis, __pyx_n_s_run_analysis, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  PyType_Modified(__pyx_ptype_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_nanopyx_core_analysis_decorr, __pyx_n_s_run_analysis, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 70, __pyx_L1_error)
 071:         """
 072:         Method used to run the analysis. Starting parameters are defined on class instance initialization.
 073:         Args:
 074:             img (np.ndarray): image to analyze
 075:         """
+076:         self.img = img.astype(np.float32)
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_img), __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->img, 0);
  __pyx_v_self->img = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+077:         return self._run_analysis()
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_run_analysis(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 078: 
+079:     cdef float[:, :] _get_preprocessed_image(self, img):
static __Pyx_memviewslice __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__get_preprocessed_image(CYTHON_UNUSED struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, PyObject *__pyx_v_img) {
  int __pyx_v_new_size;
  int __pyx_v_ox;
  int __pyx_v_oy;
  int __pyx_v_x_in;
  int __pyx_v_y_in;
  int __pyx_v_x_out;
  int __pyx_v_y_out;
  float __pyx_v_mean_img;
  __Pyx_memviewslice __pyx_v_pixels_in = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_pixels_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_output = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v__u;
  int __pyx_v__v;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_preprocessed_image", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_17);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_18, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._get_preprocessed_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_pixels_in, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_pixels_out, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_output, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 080: 
 081:         cdef int new_size, ox, oy, x_in, y_in, x_out, y_out
 082:         cdef float mean_img
 083:         cdef float[:] pixels_in, pixels_out
 084:         cdef float[:, :] output
 085: 
+086:         new_size = max(img.shape[0], img.shape[1])
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_new_size = __pyx_t_6;
+087:         new_size = <int>(pow(2, ceil(log(new_size)/log(2.0))))
  __pyx_v_new_size = ((int)pow(2.0, ceil((log(__pyx_v_new_size) / log(2.0)))));
+088:         pixels_in = np.array(img).ravel()
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_img};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ravel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[1] = {__pyx_t_2, };
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pixels_in = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
+089:         mean_img = pixels_in[0]
  __pyx_t_8 = 0;
  __pyx_v_mean_img = (*((float *) ( /* dim=0 */ (__pyx_v_pixels_in.data + __pyx_t_8 * __pyx_v_pixels_in.strides[0]) )));
+090:         pixels_out = np.full((new_size*new_size), mean_img, dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_full); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_new_size * __pyx_v_new_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mean_img); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_9, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_pixels_out = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
 091: 
+092:         ox = (new_size-img.shape[1])//2
  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_new_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ox = __pyx_t_6;
+093:         oy = (new_size-img.shape[0])//2
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_new_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_oy = __pyx_t_6;
 094: 
+095:         x_in = 0
  __pyx_v_x_in = 0;
+096:         x_out = ox
  __pyx_v_x_out = __pyx_v_ox;
+097:         y_in = 0
  __pyx_v_y_in = 0;
+098:         y_out = oy
  __pyx_v_y_out = __pyx_v_oy;
 099:         cdef int _u
 100:         cdef int _v
 101: 
+102:         for x_in in range(img.shape[1]):
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_img, __pyx_n_s_shape); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __pyx_t_10;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_11; __pyx_t_6+=1) {
    __pyx_v_x_in = __pyx_t_6;
+103:             y_out = 0
    __pyx_v_y_out = 0;
+104:             for y_in in range(img.shape[0]):
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_12 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_y_in = __pyx_t_14;
+105:                 _u = x_out + y_out*new_size
      __pyx_v__u = (__pyx_v_x_out + (__pyx_v_y_out * __pyx_v_new_size));
+106:                 _v = x_in + y_in*img.shape[1]
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_x_in); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_y_in); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_img, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v__v = __pyx_t_15;
+107:                 pixels_out[_u] = pixels_in[_v]
      __pyx_t_8 = __pyx_v__v;
      __pyx_t_16 = __pyx_v__u;
      *((float *) ( /* dim=0 */ (__pyx_v_pixels_out.data + __pyx_t_16 * __pyx_v_pixels_out.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_pixels_in.data + __pyx_t_8 * __pyx_v_pixels_in.strides[0]) )));
 108:                 # pixels_out[x_out + y_out*new_size] = pixels_in[x_in + y_in*img.shape[1]] - how it was before
+109:                 y_out += 1
      __pyx_v_y_out = (__pyx_v_y_out + 1);
    }
+110:             x_out += 1
    __pyx_v_x_out = (__pyx_v_x_out + 1);
  }
 111: 
+112:         output = np.reshape(pixels_out, (new_size, new_size))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reshape); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_pixels_out, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_new_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_new_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_3, __pyx_t_17};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_output = __pyx_t_18;
  __pyx_t_18.memview = NULL;
  __pyx_t_18.data = NULL;
 113: 
+114:         return output
  __PYX_INC_MEMVIEW(&__pyx_v_output, 1);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;
 115: 
 116: 
+117:     cdef float _linmap(self, float val, float valmin, float valmax, float mapmin, float mapmax) nogil:
static float __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__linmap(CYTHON_UNUSED struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, float __pyx_v_val, float __pyx_v_valmin, float __pyx_v_valmax, float __pyx_v_mapmin, float __pyx_v_mapmax) {
  float __pyx_v_out;
  float __pyx_r;
/* … */
  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
 118: 
+119:         cdef float out = 0
  __pyx_v_out = 0.0;
+120:         out = (val - valmin)/(valmax - valmin)
  __pyx_v_out = ((__pyx_v_val - __pyx_v_valmin) / (__pyx_v_valmax - __pyx_v_valmin));
+121:         out = out * (mapmax-mapmin) + mapmin
  __pyx_v_out = ((__pyx_v_out * (__pyx_v_mapmax - __pyx_v_mapmin)) + __pyx_v_mapmin);
+122:         return out
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 123: 
+124:     cdef float _get_corr_coef_norm(self, float[:, :] fft_real, float[:, :] fft_imag, float[:, :] mask):
static float __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__get_corr_coef_norm(CYTHON_UNUSED struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, __Pyx_memviewslice __pyx_v_fft_real, __Pyx_memviewslice __pyx_v_fft_imag, __Pyx_memviewslice __pyx_v_mask) {
  int __pyx_v_y_i;
  int __pyx_v_x_i;
  float __pyx_v_c;
  float __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_corr_coef_norm", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._get_corr_coef_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 125: 
 126:         cdef int y_i, x_i
+127:         cdef float c = 0
  __pyx_v_c = 0.0;
 128: 
+129:         with nogil:
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {
/* … */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }
+130:             for y_i in prange(fft_real.shape[0]):
        if (unlikely(!__pyx_v_fft_real.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("fft_real"); __PYX_ERR(0, 130, __pyx_L4_error) }
        __pyx_t_1 = (__pyx_v_fft_real.shape[0]);
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for reduction(+:__pyx_v_c) lastprivate(__pyx_v_x_i) firstprivate(__pyx_v_y_i) lastprivate(__pyx_v_y_i)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_y_i = (int)(0 + 1 * __pyx_t_2);
                            /* Initialize private variables to invalid values */
                            __pyx_v_x_i = ((int)0xbad0bad0);
+131:                 for x_i in range(fft_real.shape[1]):
                            __pyx_t_4 = (__pyx_v_fft_real.shape[1]);
                            __pyx_t_5 = __pyx_t_4;
                            for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
                              __pyx_v_x_i = __pyx_t_6;
+132:                     if mask[y_i, x_i] == 1:
                              __pyx_t_7 = __pyx_v_y_i;
                              __pyx_t_8 = __pyx_v_x_i;
                              __pyx_t_9 = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_7 * __pyx_v_mask.strides[0]) ) + __pyx_t_8 * __pyx_v_mask.strides[1]) ))) == 1.0);
                              if (__pyx_t_9) {
/* … */
                              }
                            }
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }
+133:                         c += fft_real[y_i, x_i]**2 + fft_imag[y_i, x_i]**2
                                __pyx_t_8 = __pyx_v_y_i;
                                __pyx_t_7 = __pyx_v_x_i;
                                __pyx_t_10 = __pyx_v_y_i;
                                __pyx_t_11 = __pyx_v_x_i;
                                __pyx_v_c = (__pyx_v_c + (powf((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fft_real.data + __pyx_t_8 * __pyx_v_fft_real.strides[0]) ) + __pyx_t_7 * __pyx_v_fft_real.strides[1]) ))), 2.0) + powf((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fft_imag.data + __pyx_t_10 * __pyx_v_fft_imag.strides[0]) ) + __pyx_t_11 * __pyx_v_fft_imag.strides[1]) ))), 2.0)));
 134: 
+135:         return sqrt(c)
  __pyx_r = sqrt(__pyx_v_c);
  goto __pyx_L0;
 136: 
+137:     cdef float[:] _get_best_score(self, float[:] kc, float[:] a):
static __Pyx_memviewslice __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__get_best_score(CYTHON_UNUSED struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, __Pyx_memviewslice __pyx_v_kc, __Pyx_memviewslice __pyx_v_a) {
  int __pyx_v_k;
  float __pyx_v_gm_max;
  __Pyx_memviewslice __pyx_v_gm = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_best_score", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._get_best_score", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_gm, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 138:         cdef int k
 139:         cdef float gm_max
 140:         cdef float[:] gm, out
 141: 
+142:         gm = np.empty(kc.shape[0], dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_kc.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_gm = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+143:         out = np.empty((3), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__14, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
/* … */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
 144: 
+145:         gm_max = 0.0
  __pyx_v_gm_max = 0.0;
 146: 
+147:         for k in range(kc.shape[0]):
  __pyx_t_7 = (__pyx_v_kc.shape[0]);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_k = __pyx_t_9;
+148:             gm[k] = kc[k]*a[k]
    __pyx_t_10 = __pyx_v_k;
    __pyx_t_11 = __pyx_v_k;
    __pyx_t_12 = __pyx_v_k;
    *((float *) ( /* dim=0 */ (__pyx_v_gm.data + __pyx_t_12 * __pyx_v_gm.strides[0]) )) = ((*((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_10 * __pyx_v_kc.strides[0]) ))) * (*((float *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_11 * __pyx_v_a.strides[0]) ))));
 149: 
+150:             if gm[k] > gm_max:
    __pyx_t_11 = __pyx_v_k;
    __pyx_t_13 = ((*((float *) ( /* dim=0 */ (__pyx_v_gm.data + __pyx_t_11 * __pyx_v_gm.strides[0]) ))) > __pyx_v_gm_max);
    if (__pyx_t_13) {
/* … */
    }
  }
+151:                 gm_max = gm[k]
      __pyx_t_11 = __pyx_v_k;
      __pyx_v_gm_max = (*((float *) ( /* dim=0 */ (__pyx_v_gm.data + __pyx_t_11 * __pyx_v_gm.strides[0]) )));
+152:                 out[0] = kc[k]
      __pyx_t_11 = __pyx_v_k;
      __pyx_t_10 = 0;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_10 * __pyx_v_out.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_11 * __pyx_v_kc.strides[0]) )));
+153:                 out[1] = a[k]
      __pyx_t_11 = __pyx_v_k;
      __pyx_t_10 = 1;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_10 * __pyx_v_out.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_11 * __pyx_v_a.strides[0]) )));
+154:                 out[2] = k
      __pyx_t_11 = 2;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_11 * __pyx_v_out.strides[0]) )) = __pyx_v_k;
 155: 
+156:         return out
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 157: 
+158:     cdef float[:] _get_max_score(self, float[:] kc, float[:] a):
static __Pyx_memviewslice __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__get_max_score(CYTHON_UNUSED struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, __Pyx_memviewslice __pyx_v_kc, __Pyx_memviewslice __pyx_v_a) {
  int __pyx_v_k;
  float __pyx_v_kc_max;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_max_score", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._get_max_score", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 159:         cdef int k
 160:         cdef float kc_max
 161:         cdef float[:] out
 162: 
+163:         out = np.empty((3), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_out = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
+164:         kc_max = 0.0
  __pyx_v_kc_max = 0.0;
 165: 
+166:         for k in range(kc.shape[0]):
  __pyx_t_6 = (__pyx_v_kc.shape[0]);
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_k = __pyx_t_8;
+167:             if kc[k] > kc_max:
    __pyx_t_9 = __pyx_v_k;
    __pyx_t_10 = ((*((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_9 * __pyx_v_kc.strides[0]) ))) > __pyx_v_kc_max);
    if (__pyx_t_10) {
/* … */
    }
  }
+168:                 kc_max = kc[k]
      __pyx_t_9 = __pyx_v_k;
      __pyx_v_kc_max = (*((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_9 * __pyx_v_kc.strides[0]) )));
+169:                 out[0] = kc[k]
      __pyx_t_9 = __pyx_v_k;
      __pyx_t_11 = 0;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_11 * __pyx_v_out.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_9 * __pyx_v_kc.strides[0]) )));
+170:                 out[1] = a[k]
      __pyx_t_9 = __pyx_v_k;
      __pyx_t_11 = 1;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_11 * __pyx_v_out.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_9 * __pyx_v_a.strides[0]) )));
+171:                 out[2] = k
      __pyx_t_9 = 2;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_9 * __pyx_v_out.strides[0]) )) = __pyx_v_k;
 172: 
+173:         return out
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 174: 
+175:     cdef float [:] _get_corr_coef_ring(self, float[:, :] fft_real, float[:, :] fft_imag, float[:, :] normalized_fft_real, float[:, :] normalized_fft_imag, float crmin, float crmax):
static __Pyx_memviewslice __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__get_corr_coef_ring(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, __Pyx_memviewslice __pyx_v_fft_real, __Pyx_memviewslice __pyx_v_fft_imag, __Pyx_memviewslice __pyx_v_normalized_fft_real, __Pyx_memviewslice __pyx_v_normalized_fft_imag, float __pyx_v_crmin, float __pyx_v_crmax) {
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_y_i;
  int __pyx_v_x_i;
  int __pyx_v_d;
  int __pyx_v_width;
  int __pyx_v_height;
  int __pyx_v_ox;
  int __pyx_v_oy;
  int __pyx_v_w;
  int __pyx_v_h;
  float __pyx_v_dist;
  float __pyx_v_k;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_corr_coef_ring", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._get_corr_coef_ring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 176: 
 177:         cdef float[:] out
 178:         cdef int y_i, x_i, d, width, height, ox, oy, w, h
 179:         cdef float dist, k
+180:         width = self.img_ref.shape[1]
  if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 180, __pyx_L1_error)}
  __pyx_v_width = (__pyx_v_self->img_ref.shape[1]);
+181:         height = self.img_ref.shape[0]
  if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 181, __pyx_L1_error)}
  __pyx_v_height = (__pyx_v_self->img_ref.shape[0]);
+182:         out = np.zeros((2*int(self.n_r)), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_MultiplyCObj(__pyx_int_2, __pyx_t_3, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 183: 
+184:         d = 0
  __pyx_v_d = 0;
+185:         dist = 0.0
  __pyx_v_dist = 0.0;
+186:         k = 0
  __pyx_v_k = 0.0;
 187: 
+188:         ox = <int>(width * (1-crmax)/2)
  __pyx_v_ox = ((int)((__pyx_v_width * (1.0 - __pyx_v_crmax)) / 2.0));
+189:         oy = <int>(height * (1-crmax)/2)
  __pyx_v_oy = ((int)((__pyx_v_height * (1.0 - __pyx_v_crmax)) / 2.0));
+190:         w = <int>(width * crmax)
  __pyx_v_w = ((int)(__pyx_v_width * __pyx_v_crmax));
+191:         h = <int>(height * crmax)
  __pyx_v_h = ((int)(__pyx_v_height * __pyx_v_crmax));
 192: 
+193:         with nogil:
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {
/* … */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L3_return: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L0;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }
+194:             for x_i in range(ox, ox+w):
        __pyx_t_7 = (__pyx_v_ox + __pyx_v_w);
        __pyx_t_8 = __pyx_t_7;
        for (__pyx_t_9 = __pyx_v_ox; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
          __pyx_v_x_i = __pyx_t_9;
+195:                 for y_i in range(oy, oy+h):
          __pyx_t_10 = (__pyx_v_oy + __pyx_v_h);
          __pyx_t_11 = __pyx_t_10;
          for (__pyx_t_12 = __pyx_v_oy; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
            __pyx_v_y_i = __pyx_t_12;
+196:                     dist = (x_i-width/2)**2 + (y_i-height/2)**2
            __pyx_v_dist = (__Pyx_pow_long((__pyx_v_x_i - (((long)__pyx_v_width) / 2)), 2) + __Pyx_pow_long((__pyx_v_y_i - (((long)__pyx_v_height) / 2)), 2));
+197:                     dist = sqrt(4*dist/(width**2))
            __pyx_v_dist = sqrt(((4.0 * __pyx_v_dist) / ((float)__Pyx_pow_long(((long)__pyx_v_width), 2))));
+198:                     k = x_i*self.img_ref.shape[0] + y_i
            if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 198, __pyx_L4_error)}
            __pyx_v_k = ((__pyx_v_x_i * (__pyx_v_self->img_ref.shape[0])) + __pyx_v_y_i);
+199:                     if k > width*height/2 + height/2:
            __pyx_t_13 = (__pyx_v_k > ((((long)(__pyx_v_width * __pyx_v_height)) / 2) + (((long)__pyx_v_height) / 2)));
            if (__pyx_t_13) {
/* … */
            }
+200:                         return out
              __PYX_INC_MEMVIEW(&__pyx_v_out, 0);
              __pyx_r = __pyx_v_out;
              goto __pyx_L3_return;
 201:                     else:
+202:                         if dist >= 0 and dist <= crmax:
            /*else*/ {
              __pyx_t_14 = (__pyx_v_dist >= 0.0);
              if (__pyx_t_14) {
              } else {
                __pyx_t_13 = __pyx_t_14;
                goto __pyx_L12_bool_binop_done;
              }
              __pyx_t_14 = (__pyx_v_dist <= __pyx_v_crmax);
              __pyx_t_13 = __pyx_t_14;
              __pyx_L12_bool_binop_done:;
              if (__pyx_t_13) {
/* … */
              }
            }
          }
        }
      }
+203:                             dist = self._linmap(dist, crmin, crmax, 0, self.n_r-1)
                __pyx_t_15 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_linmap(__pyx_v_self, __pyx_v_dist, __pyx_v_crmin, __pyx_v_crmax, 0.0, (__pyx_v_self->n_r - 1)); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 203, __pyx_L4_error)
                __pyx_v_dist = __pyx_t_15;
+204:                             if dist < 0:
                __pyx_t_13 = (__pyx_v_dist < 0.0);
                if (__pyx_t_13) {
/* … */
                }
+205:                                 dist = 0
                  __pyx_v_dist = 0.0;
+206:                             d = <int>(round(dist))
                __pyx_v_d = ((int)round(__pyx_v_dist));
+207:                             if d+self.n_r < out.shape[0]:
                __pyx_t_13 = ((__pyx_v_d + __pyx_v_self->n_r) < (__pyx_v_out.shape[0]));
                if (__pyx_t_13) {
/* … */
                }
+208:                                 out[d] += fft_real[y_i, x_i] * normalized_fft_real[y_i, x_i] + fft_imag[y_i, x_i] * normalized_fft_imag[y_i, x_i]
                  __pyx_t_16 = __pyx_v_y_i;
                  __pyx_t_17 = __pyx_v_x_i;
                  __pyx_t_18 = __pyx_v_y_i;
                  __pyx_t_19 = __pyx_v_x_i;
                  __pyx_t_20 = __pyx_v_y_i;
                  __pyx_t_21 = __pyx_v_x_i;
                  __pyx_t_22 = __pyx_v_y_i;
                  __pyx_t_23 = __pyx_v_x_i;
                  __pyx_t_24 = __pyx_v_d;
                  *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_24 * __pyx_v_out.strides[0]) )) += (((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fft_real.data + __pyx_t_16 * __pyx_v_fft_real.strides[0]) ) + __pyx_t_17 * __pyx_v_fft_real.strides[1]) ))) * (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_normalized_fft_real.data + __pyx_t_18 * __pyx_v_normalized_fft_real.strides[0]) ) + __pyx_t_19 * __pyx_v_normalized_fft_real.strides[1]) )))) + ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fft_imag.data + __pyx_t_20 * __pyx_v_fft_imag.strides[0]) ) + __pyx_t_21 * __pyx_v_fft_imag.strides[1]) ))) * (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_normalized_fft_imag.data + __pyx_t_22 * __pyx_v_normalized_fft_imag.strides[0]) ) + __pyx_t_23 * __pyx_v_normalized_fft_imag.strides[1]) )))));
+209:                                 out[d+self.n_r] += normalized_fft_real[y_i, x_i]**2 + normalized_fft_imag[y_i, x_i]**2
                  __pyx_t_23 = __pyx_v_y_i;
                  __pyx_t_22 = __pyx_v_x_i;
                  __pyx_t_21 = __pyx_v_y_i;
                  __pyx_t_20 = __pyx_v_x_i;
                  __pyx_t_19 = (__pyx_v_d + __pyx_v_self->n_r);
                  *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_19 * __pyx_v_out.strides[0]) )) += (powf((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_normalized_fft_real.data + __pyx_t_23 * __pyx_v_normalized_fft_real.strides[0]) ) + __pyx_t_22 * __pyx_v_normalized_fft_real.strides[1]) ))), 2.0) + powf((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_normalized_fft_imag.data + __pyx_t_21 * __pyx_v_normalized_fft_imag.strides[0]) ) + __pyx_t_20 * __pyx_v_normalized_fft_imag.strides[1]) ))), 2.0));
 210: 
+211:         return out
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 212: 
+213:     cdef float[:] _compute_d0(self, float[:, :] fft_real, float[:, :] fft_imag):
static __Pyx_memviewslice __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__compute_d0(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, __Pyx_memviewslice __pyx_v_fft_real, __Pyx_memviewslice __pyx_v_fft_imag) {
  int __pyx_v_k;
  float __pyx_v_d;
  float __pyx_v_c;
  __Pyx_memviewslice __pyx_v_d0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_normalized_fft = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_mask = { 0, 0, { 0 }, { 0 }, { 0 } };
  float __pyx_v_cr;
  __Pyx_memviewslice __pyx_v_coef = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_v_n;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_compute_d0", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._compute_d0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_d0, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_normalized_fft, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_mask, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_coef, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 214: 
 215:         cdef int k
 216:         cdef float d, c
 217:         cdef float[:] d0
+218:         cdef float[:, :, :] normalized_fft = _normalizeFFT(fft_real, fft_imag)
  __pyx_t_1 = __pyx_f_7nanopyx_4core_9transform_9normalize__normalizeFFT(__pyx_v_fft_real, __pyx_v_fft_imag); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 218, __pyx_L1_error)
  __pyx_v_normalized_fft = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
+219:         cdef float[:, :] mask = _get_circular_mask(fft_real.shape[1], 1)
  __pyx_t_2 = __pyx_f_7nanopyx_4core_8generate_4mask__get_circular_mask((__pyx_v_fft_real.shape[1]), 1.0); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 219, __pyx_L1_error)
  __pyx_v_mask = __pyx_t_2;
  __pyx_t_2.memview = NULL;
  __pyx_t_2.data = NULL;
+220:         cdef float cr = self._get_corr_coef_norm(fft_real, fft_imag, mask)
  __pyx_t_3 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_corr_coef_norm(__pyx_v_self, __pyx_v_fft_real, __pyx_v_fft_imag, __pyx_v_mask); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L1_error)
  __pyx_v_cr = __pyx_t_3;
+221:         cdef float[:] coef = self._get_corr_coef_ring(fft_real, fft_imag, normalized_fft[0], normalized_fft[1], self.rmin, self.rmax)
  __pyx_t_2.data = __pyx_v_normalized_fft.data;
  __pyx_t_2.memview = __pyx_v_normalized_fft.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_2, 1);
  {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_normalized_fft.strides[0];
        __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_2.shape[0] = __pyx_v_normalized_fft.shape[1];
__pyx_t_2.strides[0] = __pyx_v_normalized_fft.strides[1];
    __pyx_t_2.suboffsets[0] = -1;

__pyx_t_2.shape[1] = __pyx_v_normalized_fft.shape[2];
__pyx_t_2.strides[1] = __pyx_v_normalized_fft.strides[2];
    __pyx_t_2.suboffsets[1] = -1;

__pyx_t_4.data = __pyx_v_normalized_fft.data;
  __pyx_t_4.memview = __pyx_v_normalized_fft.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_4, 1);
  {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_normalized_fft.strides[0];
        __pyx_t_4.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_4.shape[0] = __pyx_v_normalized_fft.shape[1];
__pyx_t_4.strides[0] = __pyx_v_normalized_fft.strides[1];
    __pyx_t_4.suboffsets[0] = -1;

__pyx_t_4.shape[1] = __pyx_v_normalized_fft.shape[2];
__pyx_t_4.strides[1] = __pyx_v_normalized_fft.strides[2];
    __pyx_t_4.suboffsets[1] = -1;

__pyx_t_5 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_corr_coef_ring(__pyx_v_self, __pyx_v_fft_real, __pyx_v_fft_imag, __pyx_t_2, __pyx_t_4, __pyx_v_self->rmin, __pyx_v_self->rmax); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 221, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
  __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
  __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
  __pyx_v_coef = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
+222:         d0 = np.zeros((self.n_r), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_10, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_d0 = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
+223:         for k in range(self.n_r):
  __pyx_t_11 = __pyx_v_self->n_r;
  __pyx_t_12 = __pyx_t_11;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_k = __pyx_t_13;
+224:             d = 0
    __pyx_v_d = 0.0;
+225:             c = 0
    __pyx_v_c = 0.0;
 226: 
+227:             for n in range(k+1):
    __pyx_t_14 = (__pyx_v_k + 1);
    __pyx_t_15 = __pyx_t_14;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_v_n = __pyx_t_16;
+228:                 d += coef[n]
      __pyx_t_17 = __pyx_v_n;
      __pyx_v_d = (__pyx_v_d + (*((float *) ( /* dim=0 */ (__pyx_v_coef.data + __pyx_t_17 * __pyx_v_coef.strides[0]) ))));
+229:                 c += coef[n+self.n_r]
      __pyx_t_17 = (__pyx_v_n + __pyx_v_self->n_r);
      __pyx_v_c = (__pyx_v_c + (*((float *) ( /* dim=0 */ (__pyx_v_coef.data + __pyx_t_17 * __pyx_v_coef.strides[0]) ))));
    }
 230: 
+231:             if cr == 0 or c == 0:
    __pyx_t_19 = (__pyx_v_cr == 0.0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_c == 0.0);
    __pyx_t_18 = __pyx_t_19;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_18) {
/* … */
      goto __pyx_L7;
    }
+232:                 d0[k] = float("nan")
      __pyx_t_20 = __Pyx_PyUnicode_AsDouble(__pyx_n_u_nan); if (unlikely(__pyx_t_20 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
      __pyx_t_17 = __pyx_v_k;
      *((float *) ( /* dim=0 */ (__pyx_v_d0.data + __pyx_t_17 * __pyx_v_d0.strides[0]) )) = __pyx_t_20;
 233:             else:
+234:                 d0[k] = sqrt(2)*d/(cr*sqrt(c))
    /*else*/ {
      __pyx_t_17 = __pyx_v_k;
      *((float *) ( /* dim=0 */ (__pyx_v_d0.data + __pyx_t_17 * __pyx_v_d0.strides[0]) )) = ((sqrt(2.0) * __pyx_v_d) / (__pyx_v_cr * sqrt(__pyx_v_c)));
    }
    __pyx_L7:;
  }
 235: 
+236:         if isnan(d0[0]):
  __pyx_t_17 = 0;
  __pyx_t_18 = isnan((*((float *) ( /* dim=0 */ (__pyx_v_d0.data + __pyx_t_17 * __pyx_v_d0.strides[0]) ))));
  if (__pyx_t_18) {
/* … */
  }
+237:             d0[0] = 0
    __pyx_t_17 = 0;
    *((float *) ( /* dim=0 */ (__pyx_v_d0.data + __pyx_t_17 * __pyx_v_d0.strides[0]) )) = 0.0;
 238: 
+239:         return d0
  __PYX_INC_MEMVIEW(&__pyx_v_d0, 1);
  __pyx_r = __pyx_v_d0;
  goto __pyx_L0;
 240: 
+241:     cdef float[:] _get_d_corr_max(self, float[:] d, float r1, float r2) nogil:
static __Pyx_memviewslice __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__get_d_corr_max(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self, __Pyx_memviewslice __pyx_v_d, float __pyx_v_r1, float __pyx_v_r2) {
  __Pyx_memviewslice __pyx_v_t = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_temp_min = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_d_length;
  float __pyx_v_dt;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_d_corr_max", 0);
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
/* … */
  /* function exit code */
  __pyx_L1_error:;
  #ifdef WITH_THREAD
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._get_d_corr_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  __pyx_L2:;
  #ifdef WITH_THREAD
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_t, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_temp_min, 1);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}
 242:         cdef float[:] t, out, temp_min
 243:         cdef int d_length
+244:         cdef float dt = 0.001
  __pyx_v_dt = 0.001;
 245: 
+246:         with gil:
  {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
      #endif
      /*try:*/ {
/* … */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_PyGILState_Release(__pyx_gilstate_save);
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_PyGILState_Release(__pyx_gilstate_save);
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }
+247:             t = np.copy(d)
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_d, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 247, __pyx_L4_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_t = __pyx_t_6;
        __pyx_t_6.memview = NULL;
        __pyx_t_6.data = NULL;
      }
 248: 
+249:         out = _get_max(d, 0, self.n_r)
  __pyx_t_6 = __pyx_f_7nanopyx_4core_5utils_5array__get_max(__pyx_v_d, 0, __pyx_v_self->n_r); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 249, __pyx_L1_error)
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+250:         temp_min = _get_min(d, 0, self.n_r)
  __pyx_t_6 = __pyx_f_7nanopyx_4core_5utils_5array__get_min(__pyx_v_d, 0, __pyx_v_self->n_r); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 250, __pyx_L1_error)
  __pyx_v_temp_min = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+251:         d_length = t.shape[0]
  __pyx_v_d_length = (__pyx_v_t.shape[0]);
 252: 
+253:         while out[0] == d_length-1:
  while (1) {
    __pyx_t_7 = 0;
    __pyx_t_8 = ((*((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) ))) == (__pyx_v_d_length - 1));
    if (!__pyx_t_8) break;
+254:             t[d_length-1] = 0
    __pyx_t_7 = (__pyx_v_d_length - 1);
    *((float *) ( /* dim=0 */ (__pyx_v_t.data + __pyx_t_7 * __pyx_v_t.strides[0]) )) = 0.0;
+255:             d_length -= 1
    __pyx_v_d_length = (__pyx_v_d_length - 1);
+256:             if d_length == 0:
    __pyx_t_8 = (__pyx_v_d_length == 0);
    if (__pyx_t_8) {
/* … */
    }
+257:                 out[0] = 0
      __pyx_t_7 = 0;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) )) = 0.0;
+258:                 out[1] = 0
      __pyx_t_7 = 1;
      *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) )) = 0.0;
+259:                 return out
      __PYX_INC_MEMVIEW(&__pyx_v_out, 0);
      __pyx_r = __pyx_v_out;
      goto __pyx_L0;
 260:             else:
+261:                 out = _get_max(t, 0, self.n_r)
    /*else*/ {
      __pyx_t_6 = __pyx_f_7nanopyx_4core_5utils_5array__get_max(__pyx_v_t, 0, __pyx_v_self->n_r); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 261, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 0);
      __pyx_v_out = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;
+262:                 temp_min = _get_min(t, int(out[0]), d_length-1)
      __pyx_t_7 = 0;
      __pyx_t_6 = __pyx_f_7nanopyx_4core_5utils_5array__get_min(__pyx_v_t, ((int)(*((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) )))), (__pyx_v_d_length - 1)); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 262, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_temp_min, 0);
      __pyx_v_temp_min = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;
 263: 
+264:                 if t[<int>(out[0])] - temp_min[1] > dt:
      __pyx_t_7 = 0;
      __pyx_t_9 = ((int)(*((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) ))));
      __pyx_t_10 = 1;
      __pyx_t_8 = (((*((float *) ( /* dim=0 */ (__pyx_v_t.data + __pyx_t_9 * __pyx_v_t.strides[0]) ))) - (*((float *) ( /* dim=0 */ (__pyx_v_temp_min.data + __pyx_t_10 * __pyx_v_temp_min.strides[0]) )))) > __pyx_v_dt);
      if (__pyx_t_8) {
/* … */
      }
+265:                     return out
        __PYX_INC_MEMVIEW(&__pyx_v_out, 0);
        __pyx_r = __pyx_v_out;
        goto __pyx_L0;
 266:                 else:
+267:                     t[<int>(out[0])] = temp_min[1]
      /*else*/ {
        __pyx_t_10 = 1;
        __pyx_t_7 = 0;
        __pyx_t_9 = ((int)(*((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) ))));
        *((float *) ( /* dim=0 */ (__pyx_v_t.data + __pyx_t_9 * __pyx_v_t.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_temp_min.data + __pyx_t_10 * __pyx_v_temp_min.strides[0]) )));
+268:                     out[0] = d_length - 1
        __pyx_t_10 = 0;
        *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_10 * __pyx_v_out.strides[0]) )) = (__pyx_v_d_length - 1);
      }
    }
  }
 269: 
+270:         out[0] = r1 + (r2-r1)*out[0]/(self.n_r-1)
  __pyx_t_10 = 0;
  __pyx_t_7 = 0;
  *((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) )) = (__pyx_v_r1 + (((__pyx_v_r2 - __pyx_v_r1) * (*((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_10 * __pyx_v_out.strides[0]) )))) / ((float)(__pyx_v_self->n_r - 1))));
+271:         return out
  __PYX_INC_MEMVIEW(&__pyx_v_out, 0);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 272: 
+273:     cdef float[:, :] _compute_d(self):
static __Pyx_memviewslice __pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__compute_d(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_coef = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_kc = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_a = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dg = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_results_gm = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_results_max = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fft = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_d_curve = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_img_ref = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_blurred = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_mask = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fft_real = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fft_imag = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_normalized_fft = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_count;
  float __pyx_v_g_max;
  float __pyx_v_g_min;
  float __pyx_v_crmin;
  float __pyx_v_crmax;
  float __pyx_v_d;
  float __pyx_v_c;
  float __pyx_v_ind1;
  float __pyx_v_ind2;
  float __pyx_v_cr;
  double __pyx_v_sig;
  int __pyx_v_refine;
  int __pyx_v_k;
  int __pyx_v_j;
  int __pyx_v_h;
  int __pyx_v_i;
  long __pyx_v_n;
  double __pyx_v_g_temp;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_compute_d", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __Pyx_XDECREF(__pyx_t_14);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_15, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_16, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_17, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_18, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._compute_d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_coef, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_kc, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_a, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dg, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_results_gm, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_results_max, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_d_curve, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_img_ref, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_blurred, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_mask, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft_real, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft_imag, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_normalized_fft, 1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 274: 
 275:         cdef float[:] coef, kc, a, dg, result, results_gm, results_max
 276:         cdef complex[:, :] fft
 277:         cdef float[:, :] d_curve, img_ref, blurred, mask, fft_real, fft_imag
 278:         cdef float[:, :, :] normalized_fft
+279:         cdef int count = 0
  __pyx_v_count = 0;
 280:         cdef float g_max, g_min, crmin, crmax, d, c, ind1, ind2, cr
 281:         cdef double sig
 282:         cdef int refine, k, j, h, i
 283: 
+284:         d_curve = np.zeros((self.n_r, 2*self.n_g), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_long((2 * __pyx_v_self->n_g)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_d_curve = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 285: 
+286:         if self.kc0 == 0:
  __pyx_t_7 = (__pyx_v_self->kc0 == 0.0);
  if (__pyx_t_7) {
/* … */
    goto __pyx_L3;
  }
+287:             g_max = self.img_ref.shape[1] / 2
    if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 287, __pyx_L1_error)}
    __pyx_v_g_max = ((__pyx_v_self->img_ref.shape[1]) / 2);
 288:         else:
+289:             g_max = 2 / self.kc0
  /*else*/ {
    __pyx_v_g_max = (2.0 / __pyx_v_self->kc0);
  }
  __pyx_L3:;
 290: 
+291:         g_min = 0.14
  __pyx_v_g_min = 0.14;
 292: 
+293:         img_ref = np.copy(self.img_ref)
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 293, __pyx_L1_error)}
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_self->img_ref, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_img_ref = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+294:         img_ref = self._get_preprocessed_image(img_ref)
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_img_ref, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_preprocessed_image(__pyx_v_self, __pyx_t_5); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 294, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_img_ref, 1);
  __pyx_v_img_ref = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+295:         blurred = np.copy(self.img_ref)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 295, __pyx_L1_error)}
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->img_ref, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_blurred = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 296: 
+297:         crmin = self.rmin
  __pyx_t_9 = __pyx_v_self->rmin;
  __pyx_v_crmin = __pyx_t_9;
+298:         crmax = self.rmax
  __pyx_t_9 = __pyx_v_self->rmax;
  __pyx_v_crmax = __pyx_t_9;
 299: 
+300:         mask = _get_circular_mask(img_ref.shape[1], 1)
  __pyx_t_6 = __pyx_f_7nanopyx_4core_8generate_4mask__get_circular_mask((__pyx_v_img_ref.shape[1]), 1.0); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 300, __pyx_L1_error)
  __pyx_v_mask = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 301: 
+302:         for refine in range(2):
  for (__pyx_t_8 = 0; __pyx_t_8 < 2; __pyx_t_8+=1) {
    __pyx_v_refine = __pyx_t_8;
+303:             for k in range(self.n_g):
    __pyx_t_10 = __pyx_v_self->n_g;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_k = __pyx_t_12;
+304:                 sig = exp(log(g_min) + (log(g_max) - log(g_min))*(<float>(k)/(self.n_g-1)))
      __pyx_v_sig = exp((log(__pyx_v_g_min) + ((log(__pyx_v_g_max) - log(__pyx_v_g_min)) * (((float)__pyx_v_k) / ((float)(__pyx_v_self->n_g - 1))))));
+305:                 blurred = np.copy(self.img_ref)
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 305, __pyx_L1_error)}
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_self->img_ref, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 305, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_blurred, 1);
      __pyx_v_blurred = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;
+306:                 blurred = gaussian_filter(blurred, sig)
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_gaussian_filter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_blurred, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_sig); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_4, __pyx_t_2};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_13, 2+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_blurred, 1);
      __pyx_v_blurred = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;
+307:                 blurred = np.copy(self.img_ref) - blurred
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 307, __pyx_L1_error)}
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->img_ref, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_blurred, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_blurred, 1);
      __pyx_v_blurred = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;
+308:                 fft = np.fft.fftshift(np.fft.fft2(blurred))
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fft); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fftshift); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_fft); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fft2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_blurred, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_1};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_4 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft, 1);
      __pyx_v_fft = __pyx_t_15;
      __pyx_t_15.memview = NULL;
      __pyx_t_15.data = NULL;
+309:                 fft_real = np.real(fft).astype(np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_fft, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft_real, 1);
      __pyx_v_fft_real = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;
+310:                 fft_imag = np.imag(fft).astype(np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_fft, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft_imag, 1);
      __pyx_v_fft_imag = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;
+311:                 normalized_fft = _normalizeFFT(fft_real, fft_imag)
      __pyx_t_16 = __pyx_f_7nanopyx_4core_9transform_9normalize__normalizeFFT(__pyx_v_fft_real, __pyx_v_fft_imag); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 311, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_normalized_fft, 1);
      __pyx_v_normalized_fft = __pyx_t_16;
      __pyx_t_16.memview = NULL;
      __pyx_t_16.data = NULL;
+312:                 cr = self._get_corr_coef_norm(fft_real, fft_imag, mask)
      __pyx_t_9 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_corr_coef_norm(__pyx_v_self, __pyx_v_fft_real, __pyx_v_fft_imag, __pyx_v_mask); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 312, __pyx_L1_error)
      __pyx_v_cr = __pyx_t_9;
+313:                 coef = self._get_corr_coef_ring(fft_real, fft_imag, normalized_fft[0], normalized_fft[1], crmin, crmax)
      __pyx_t_6.data = __pyx_v_normalized_fft.data;
      __pyx_t_6.memview = __pyx_v_normalized_fft.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_6, 1);
      {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_normalized_fft.strides[0];
        __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_6.shape[0] = __pyx_v_normalized_fft.shape[1];
__pyx_t_6.strides[0] = __pyx_v_normalized_fft.strides[1];
    __pyx_t_6.suboffsets[0] = -1;

__pyx_t_6.shape[1] = __pyx_v_normalized_fft.shape[2];
__pyx_t_6.strides[1] = __pyx_v_normalized_fft.strides[2];
    __pyx_t_6.suboffsets[1] = -1;

__pyx_t_17.data = __pyx_v_normalized_fft.data;
      __pyx_t_17.memview = __pyx_v_normalized_fft.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_17, 1);
      {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_stride = __pyx_v_normalized_fft.strides[0];
        __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_17.shape[0] = __pyx_v_normalized_fft.shape[1];
__pyx_t_17.strides[0] = __pyx_v_normalized_fft.strides[1];
    __pyx_t_17.suboffsets[0] = -1;

__pyx_t_17.shape[1] = __pyx_v_normalized_fft.shape[2];
__pyx_t_17.strides[1] = __pyx_v_normalized_fft.strides[2];
    __pyx_t_17.suboffsets[1] = -1;

__pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_corr_coef_ring(__pyx_v_self, __pyx_v_fft_real, __pyx_v_fft_imag, __pyx_t_6, __pyx_t_17, __pyx_v_crmin, __pyx_v_crmax); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 313, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
      __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_17, 1);
      __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_coef, 1);
      __pyx_v_coef = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
 314: 
+315:                 for i in range(self.n_r):
      __pyx_t_13 = __pyx_v_self->n_r;
      __pyx_t_19 = __pyx_t_13;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_i = __pyx_t_20;
+316:                     d = 0
        __pyx_v_d = 0.0;
+317:                     c = 0
        __pyx_v_c = 0.0;
 318: 
+319:                     for n in range(i+1):
        __pyx_t_21 = (__pyx_v_i + 1);
        __pyx_t_22 = __pyx_t_21;
        for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
          __pyx_v_n = __pyx_t_23;
+320:                         d += coef[n]
          __pyx_t_24 = __pyx_v_n;
          __pyx_v_d = (__pyx_v_d + (*((float *) ( /* dim=0 */ (__pyx_v_coef.data + __pyx_t_24 * __pyx_v_coef.strides[0]) ))));
+321:                         c += coef[n+self.n_r]
          __pyx_t_24 = (__pyx_v_n + __pyx_v_self->n_r);
          __pyx_v_c = (__pyx_v_c + (*((float *) ( /* dim=0 */ (__pyx_v_coef.data + __pyx_t_24 * __pyx_v_coef.strides[0]) ))));
        }
+322:                     if cr == 0 or c == 0:
        __pyx_t_25 = (__pyx_v_cr == 0.0);
        if (!__pyx_t_25) {
        } else {
          __pyx_t_7 = __pyx_t_25;
          goto __pyx_L13_bool_binop_done;
        }
        __pyx_t_25 = (__pyx_v_c == 0.0);
        __pyx_t_7 = __pyx_t_25;
        __pyx_L13_bool_binop_done:;
        if (__pyx_t_7) {
/* … */
          goto __pyx_L12;
        }
+323:                         d_curve[i][count] = float("nan") # TODO: check this is ok, this is a workaround for differences in java and python
          __pyx_t_26 = __Pyx_PyUnicode_AsDouble(__pyx_n_u_nan); if (unlikely(__pyx_t_26 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 323, __pyx_L1_error)
          __pyx_t_24 = __pyx_v_i;
          __pyx_t_27 = __pyx_v_count;
          *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_d_curve.data + __pyx_t_24 * __pyx_v_d_curve.strides[0]) ) + __pyx_t_27 * __pyx_v_d_curve.strides[1]) )) = __pyx_t_26;
 324:                     else:
+325:                         d_curve[i][count] = sqrt(2)*d/(cr*sqrt(c))
        /*else*/ {
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_count;
          *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_d_curve.data + __pyx_t_27 * __pyx_v_d_curve.strides[0]) ) + __pyx_t_24 * __pyx_v_d_curve.strides[1]) )) = ((sqrt(2.0) * __pyx_v_d) / (__pyx_v_cr * sqrt(__pyx_v_c)));
        }
        __pyx_L12:;
      }
 326: 
+327:                 if isnan(d_curve[0][count]):
      __pyx_t_24 = 0;
      __pyx_t_27 = __pyx_v_count;
      __pyx_t_7 = isnan((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_d_curve.data + __pyx_t_24 * __pyx_v_d_curve.strides[0]) ) + __pyx_t_27 * __pyx_v_d_curve.strides[1]) ))));
      if (__pyx_t_7) {
/* … */
      }
+328:                     d_curve[0][count] = 0
        __pyx_t_27 = 0;
        __pyx_t_24 = __pyx_v_count;
        *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_d_curve.data + __pyx_t_27 * __pyx_v_d_curve.strides[0]) ) + __pyx_t_24 * __pyx_v_d_curve.strides[1]) )) = 0.0;
+329:                 count += 1
      __pyx_v_count = (__pyx_v_count + 1);
    }
 330: 
+331:             if refine == 0:
    __pyx_t_7 = (__pyx_v_refine == 0);
    if (__pyx_t_7) {
/* … */
      goto __pyx_L16;
    }
+332:                 kc = np.zeros((self.n_g+1), dtype=np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_self->n_g + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_kc, 1);
      __pyx_v_kc = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+333:                 a = np.zeros((self.n_g+1), dtype=np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_self->n_g + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_a, 1);
      __pyx_v_a = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+334:                 dg = np.zeros((self.n_r), dtype=np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_dg, 1);
      __pyx_v_dg = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+335:                 result = np.zeros((2), dtype=np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1);
      __pyx_v_result = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
/* … */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_int_2); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
 336: 
+337:                 with nogil:
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
/* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L21;
            }
            __pyx_L20_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L21:;
          }
      }
+338:                     for j in range(self.n_g):
            __pyx_t_10 = __pyx_v_self->n_g;
            __pyx_t_11 = __pyx_t_10;
            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
              __pyx_v_j = __pyx_t_12;
+339:                         for h in prange(self.n_r):
              __pyx_t_13 = __pyx_v_self->n_r;
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_20 = (__pyx_t_13 - 0 + 1 - 1/abs(1)) / 1;
                  if (__pyx_t_20 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for firstprivate(__pyx_v_h) lastprivate(__pyx_v_h)
                          #endif /* _OPENMP */
                          for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_20; __pyx_t_19++){
                              {
                                  __pyx_v_h = (int)(0 + 1 * __pyx_t_19);
+340:                             dg[h] = d_curve[h][j]
                                  __pyx_t_24 = __pyx_v_h;
                                  __pyx_t_27 = __pyx_v_j;
                                  __pyx_t_28 = __pyx_v_h;
                                  *((float *) ( /* dim=0 */ (__pyx_v_dg.data + __pyx_t_28 * __pyx_v_dg.strides[0]) )) = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_d_curve.data + __pyx_t_24 * __pyx_v_d_curve.strides[0]) ) + __pyx_t_27 * __pyx_v_d_curve.strides[1]) )));
                              }
                          }
                      }
                  }
              }
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   __builtin_expect(!!(x), 1)
                  #define unlikely(x) __builtin_expect(!!(x), 0)
              #endif
+341:                         result = self._get_d_corr_max(dg, crmin, crmax)
              __pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_d_corr_max(__pyx_v_self, __pyx_v_dg, __pyx_v_crmin, __pyx_v_crmax); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 341, __pyx_L20_error)
              __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 0);
              __pyx_v_result = __pyx_t_18;
              __pyx_t_18.memview = NULL;
              __pyx_t_18.data = NULL;
+342:                         kc[j] = result[0]
              __pyx_t_27 = 0;
              __pyx_t_24 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_24 * __pyx_v_kc.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
+343:                         a[j] = result[1]
              __pyx_t_27 = 1;
              __pyx_t_24 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_24 * __pyx_v_a.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
+344:                         self.kc[j] = result[0]
              __pyx_t_27 = 0;
              if (unlikely(!__pyx_v_self->kc.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 344, __pyx_L20_error)}
              __pyx_t_24 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_self->kc.data + __pyx_t_24 * __pyx_v_self->kc.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
+345:                         self.a_g[j] = result[1]
              __pyx_t_27 = 1;
              if (unlikely(!__pyx_v_self->a_g.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 345, __pyx_L20_error)}
              __pyx_t_24 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_self->a_g.data + __pyx_t_24 * __pyx_v_self->a_g.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
            }
          }
 346: 
+347:                 result = self._get_d_corr_max(self.d0, crmin, crmax)
      if (unlikely(!__pyx_v_self->d0.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 347, __pyx_L1_error)}
      __pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_d_corr_max(__pyx_v_self, __pyx_v_self->d0, __pyx_v_crmin, __pyx_v_crmax); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 347, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1);
      __pyx_v_result = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
 348: 
+349:                 kc[self.n_g] = result[0]
      __pyx_t_27 = 0;
      __pyx_t_24 = __pyx_v_self->n_g;
      *((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_24 * __pyx_v_kc.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
+350:                 a[self.n_g] = result[1]
      __pyx_t_27 = 1;
      __pyx_t_24 = __pyx_v_self->n_g;
      *((float *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_24 * __pyx_v_a.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
+351:                 self.kc[self.n_g] = result[0]
      __pyx_t_27 = 0;
      if (unlikely(!__pyx_v_self->kc.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 351, __pyx_L1_error)}
      __pyx_t_24 = __pyx_v_self->n_g;
      *((float *) ( /* dim=0 */ (__pyx_v_self->kc.data + __pyx_t_24 * __pyx_v_self->kc.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
+352:                 self.a_g[self.n_g] = result[1]
      __pyx_t_27 = 1;
      if (unlikely(!__pyx_v_self->a_g.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 352, __pyx_L1_error)}
      __pyx_t_24 = __pyx_v_self->n_g;
      *((float *) ( /* dim=0 */ (__pyx_v_self->a_g.data + __pyx_t_24 * __pyx_v_self->a_g.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_27 * __pyx_v_result.strides[0]) )));
 353: 
+354:                 results_gm = self._get_best_score(kc, a)
      __pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_best_score(__pyx_v_self, __pyx_v_kc, __pyx_v_a); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 354, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_results_gm, 1);
      __pyx_v_results_gm = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+355:                 results_max = self._get_max_score(kc, a)
      __pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_max_score(__pyx_v_self, __pyx_v_kc, __pyx_v_a); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 355, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_results_max, 1);
      __pyx_v_results_max = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
 356: 
+357:                 crmin = fmin(results_gm[0], results_max[0]) - 0.05
      __pyx_t_27 = 0;
      __pyx_t_24 = 0;
      __pyx_v_crmin = (fmin((*((float *) ( /* dim=0 */ (__pyx_v_results_gm.data + __pyx_t_27 * __pyx_v_results_gm.strides[0]) ))), (*((float *) ( /* dim=0 */ (__pyx_v_results_max.data + __pyx_t_24 * __pyx_v_results_max.strides[0]) )))) - 0.05);
+358:                 if crmin < self.rmin:
      __pyx_t_7 = (__pyx_v_crmin < __pyx_v_self->rmin);
      if (__pyx_t_7) {
/* … */
      }
+359:                     crmin = self.rmin
        __pyx_t_9 = __pyx_v_self->rmin;
        __pyx_v_crmin = __pyx_t_9;
 360: 
+361:                 crmax = fmax(results_gm[0], results_max[0]) + 0.3
      __pyx_t_24 = 0;
      __pyx_t_27 = 0;
      __pyx_v_crmax = (fmax((*((float *) ( /* dim=0 */ (__pyx_v_results_gm.data + __pyx_t_24 * __pyx_v_results_gm.strides[0]) ))), (*((float *) ( /* dim=0 */ (__pyx_v_results_max.data + __pyx_t_27 * __pyx_v_results_max.strides[0]) )))) + 0.3);
+362:                 if crmax > self.rmax:
      __pyx_t_7 = (__pyx_v_crmax > __pyx_v_self->rmax);
      if (__pyx_t_7) {
/* … */
      }
+363:                     crmax = self.rmax
        __pyx_t_9 = __pyx_v_self->rmax;
        __pyx_v_crmax = __pyx_t_9;
 364: 
+365:                 crmax = 0.5
      __pyx_v_crmax = 0.5;
+366:                 self.rmin2 = crmin
      __pyx_v_self->rmin2 = __pyx_v_crmin;
+367:                 self.rmax2 = crmax
      __pyx_v_self->rmax2 = __pyx_v_crmax;
 368: 
+369:                 ind1 = fmin(results_gm[2], results_max[2]) - 1
      __pyx_t_27 = 2;
      __pyx_t_24 = 2;
      __pyx_v_ind1 = (fmin((*((float *) ( /* dim=0 */ (__pyx_v_results_gm.data + __pyx_t_27 * __pyx_v_results_gm.strides[0]) ))), (*((float *) ( /* dim=0 */ (__pyx_v_results_max.data + __pyx_t_24 * __pyx_v_results_max.strides[0]) )))) - 1.0);
+370:                 ind2 = fmax(results_gm[2], results_max[2])
      __pyx_t_24 = 2;
      __pyx_t_27 = 2;
      __pyx_v_ind2 = fmax((*((float *) ( /* dim=0 */ (__pyx_v_results_gm.data + __pyx_t_24 * __pyx_v_results_gm.strides[0]) ))), (*((float *) ( /* dim=0 */ (__pyx_v_results_max.data + __pyx_t_27 * __pyx_v_results_max.strides[0]) ))));
 371: 
+372:                 if ind2 < self.n_g:
      __pyx_t_7 = (__pyx_v_ind2 < __pyx_v_self->n_g);
      if (__pyx_t_7) {
/* … */
        goto __pyx_L32;
      }
+373:                     g_temp = exp(log(g_min) + (log(g_max)-log(g_min))*(ind1/(self.n_g-1)))
        __pyx_v_g_temp = exp((log(__pyx_v_g_min) + ((log(__pyx_v_g_max) - log(__pyx_v_g_min)) * (__pyx_v_ind1 / ((float)(__pyx_v_self->n_g - 1))))));
+374:                     g_max = exp(log(g_min) + (log(g_max)-log(g_min))*(ind2/(self.n_g-1)))
        __pyx_v_g_max = exp((log(__pyx_v_g_min) + ((log(__pyx_v_g_max) - log(__pyx_v_g_min)) * (__pyx_v_ind2 / ((float)(__pyx_v_self->n_g - 1))))));
+375:                     g_min = g_temp
        __pyx_v_g_min = __pyx_v_g_temp;
 376:                 else:
+377:                     g_max = g_min
      /*else*/ {
        __pyx_v_g_max = __pyx_v_g_min;
+378:                     g_min = 2 / self.img_ref.shape[1]
        if (unlikely(!__pyx_v_self->img_ref.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 378, __pyx_L1_error)}
        __pyx_v_g_min = (2 / (__pyx_v_self->img_ref.shape[1]));
      }
      __pyx_L32:;
 379: 
 380:             else:
+381:                 kc = np.zeros((self.n_g), dtype=np.float32)
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n_g); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 381, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_kc, 1);
      __pyx_v_kc = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+382:                 a = np.zeros((self.n_g), dtype=np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->n_g); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 382, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_a, 1);
      __pyx_v_a = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+383:                 dg = np.zeros((self.n_r), dtype=np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_dg, 1);
      __pyx_v_dg = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+384:                 result = np.zeros((2), dtype=np.float32)
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1);
      __pyx_v_result = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
 385: 
+386:                 with nogil:
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
/* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L37;
            }
            __pyx_L36_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L37:;
          }
      }
+387:                     for j in range(self.n_g):
            __pyx_t_10 = __pyx_v_self->n_g;
            __pyx_t_11 = __pyx_t_10;
            for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
              __pyx_v_j = __pyx_t_12;
+388:                         for h in prange(self.n_r):
              __pyx_t_20 = __pyx_v_self->n_r;
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_13 = (__pyx_t_20 - 0 + 1 - 1/abs(1)) / 1;
                  if (__pyx_t_13 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for firstprivate(__pyx_v_h) lastprivate(__pyx_v_h)
                          #endif /* _OPENMP */
                          for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_13; __pyx_t_19++){
                              {
                                  __pyx_v_h = (int)(0 + 1 * __pyx_t_19);
+389:                             dg[h] = d_curve[h][j+self.n_g]
                                  __pyx_t_27 = __pyx_v_h;
                                  __pyx_t_24 = (__pyx_v_j + __pyx_v_self->n_g);
                                  __pyx_t_28 = __pyx_v_h;
                                  *((float *) ( /* dim=0 */ (__pyx_v_dg.data + __pyx_t_28 * __pyx_v_dg.strides[0]) )) = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_d_curve.data + __pyx_t_27 * __pyx_v_d_curve.strides[0]) ) + __pyx_t_24 * __pyx_v_d_curve.strides[1]) )));
                              }
                          }
                      }
                  }
              }
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   __builtin_expect(!!(x), 1)
                  #define unlikely(x) __builtin_expect(!!(x), 0)
              #endif
+390:                         result = self._get_d_corr_max(dg, crmin, crmax)
              __pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_d_corr_max(__pyx_v_self, __pyx_v_dg, __pyx_v_crmin, __pyx_v_crmax); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 390, __pyx_L36_error)
              __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 0);
              __pyx_v_result = __pyx_t_18;
              __pyx_t_18.memview = NULL;
              __pyx_t_18.data = NULL;
+391:                         kc[j] = result[0]
              __pyx_t_24 = 0;
              __pyx_t_27 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_kc.data + __pyx_t_27 * __pyx_v_kc.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_24 * __pyx_v_result.strides[0]) )));
+392:                         a[j] = result[1]
              __pyx_t_24 = 1;
              __pyx_t_27 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_27 * __pyx_v_a.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_24 * __pyx_v_result.strides[0]) )));
+393:                         self.kc[j] = result[0]
              __pyx_t_24 = 0;
              if (unlikely(!__pyx_v_self->kc.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 393, __pyx_L36_error)}
              __pyx_t_27 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_self->kc.data + __pyx_t_27 * __pyx_v_self->kc.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_24 * __pyx_v_result.strides[0]) )));
+394:                         self.a_g[j] = result[1]
              __pyx_t_24 = 1;
              if (unlikely(!__pyx_v_self->a_g.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 394, __pyx_L36_error)}
              __pyx_t_27 = __pyx_v_j;
              *((float *) ( /* dim=0 */ (__pyx_v_self->a_g.data + __pyx_t_27 * __pyx_v_self->a_g.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_24 * __pyx_v_result.strides[0]) )));
            }
          }
+395:                 results_gm = self._get_best_score(kc, a)
      __pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_best_score(__pyx_v_self, __pyx_v_kc, __pyx_v_a); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 395, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_results_gm, 1);
      __pyx_v_results_gm = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
+396:                 results_max = self._get_max_score(kc, a)
      __pyx_t_18 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_max_score(__pyx_v_self, __pyx_v_kc, __pyx_v_a); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 396, __pyx_L1_error)
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_results_max, 1);
      __pyx_v_results_max = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;
 397: 
+398:                 self.kc_gm = results_gm[0]
      __pyx_t_24 = 0;
      __pyx_v_self->kc_gm = (*((float *) ( /* dim=0 */ (__pyx_v_results_gm.data + __pyx_t_24 * __pyx_v_results_gm.strides[0]) )));
+399:                 self.agm = results_gm[1]
      __pyx_t_24 = 1;
      __pyx_v_self->agm = (*((float *) ( /* dim=0 */ (__pyx_v_results_gm.data + __pyx_t_24 * __pyx_v_results_gm.strides[0]) )));
+400:                 self.kc_max = results_max[0]
      __pyx_t_24 = 0;
      __pyx_v_self->kc_max = (*((float *) ( /* dim=0 */ (__pyx_v_results_max.data + __pyx_t_24 * __pyx_v_results_max.strides[0]) )));
+401:                 self.a_max = results_max[1]
      __pyx_t_24 = 1;
      __pyx_v_self->a_max = (*((float *) ( /* dim=0 */ (__pyx_v_results_max.data + __pyx_t_24 * __pyx_v_results_max.strides[0]) )));
    }
    __pyx_L16:;
  }
 402: 
+403:         return d_curve
  __PYX_INC_MEMVIEW(&__pyx_v_d_curve, 1);
  __pyx_r = __pyx_v_d_curve;
  goto __pyx_L0;
 404: 
+405:     cdef _run_analysis(self):
static PyObject *__pyx_f_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis__run_analysis(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_img_fft = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_img_ref = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_img_f = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fft_real = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_fft_imag = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_run_analysis", 0);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_14, 1);
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis._run_analysis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_img_fft, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_img_ref, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_img_f, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_temp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft_real, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_fft_imag, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 406: 
 407:         cdef float[:] out
 408:         cdef complex[:, :] img_fft
 409:         cdef float[:, :] img_ref, img_f, temp, fft_real, fft_imag
 410:         cdef float resolution
+411:         img_ref = np.copy(self.img)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_v_self->img.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 411, __pyx_L1_error)}
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_self->img, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_img_ref = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+412:         img_f = np.copy(self.img)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_v_self->img.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 412, __pyx_L1_error)}
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->img, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_img_f = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 413: 
+414:         if self.x0 == self.x1 or self.y0 == self.y1:
  __pyx_t_8 = (__pyx_v_self->x0 == __pyx_v_self->x1);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_self->y0 == __pyx_v_self->y1);
  __pyx_t_7 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_7) {
/* … */
    goto __pyx_L3;
  }
+415:             self.img_ref = img_ref
    __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->img_ref, 0);
    __PYX_INC_MEMVIEW(&__pyx_v_img_ref, 1);
    __pyx_v_self->img_ref = __pyx_v_img_ref;
 416:         else:
+417:             self.img_ref = img_ref[self.y0:self.y1, self.x0:self.x1]
  /*else*/ {
    __pyx_t_6.data = __pyx_v_img_ref.data;
    __pyx_t_6.memview = __pyx_v_img_ref.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_6, 1);
    __pyx_t_5 = -1;
    if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_6,
    __pyx_v_img_ref.shape[0], __pyx_v_img_ref.strides[0], __pyx_v_img_ref.suboffsets[0],
    0,
    0,
    &__pyx_t_5,
    __pyx_v_self->y0,
    __pyx_v_self->y1,
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 417, __pyx_L1_error)
}

if (unlikely(__pyx_memoryview_slice_memviewslice(
    &__pyx_t_6,
    __pyx_v_img_ref.shape[1], __pyx_v_img_ref.strides[1], __pyx_v_img_ref.suboffsets[1],
    1,
    1,
    &__pyx_t_5,
    __pyx_v_self->x0,
    __pyx_v_self->x1,
    0,
    1,
    1,
    0,
    1) < 0))
{
    __PYX_ERR(0, 417, __pyx_L1_error)
}

__PYX_XCLEAR_MEMVIEW(&__pyx_v_self->img_ref, 0);
    __pyx_v_self->img_ref = __pyx_t_6;
    __pyx_t_6.memview = NULL;
    __pyx_t_6.data = NULL;
  }
  __pyx_L3:;
 418: 
+419:         img_f = _apodize_edges(img_f)
  __pyx_t_6 = __pyx_f_7nanopyx_4core_9transform_5edges__apodize_edges(__pyx_v_img_f); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 419, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_img_f, 1);
  __pyx_v_img_f = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+420:         temp = self._get_preprocessed_image(img_f)
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_img_f, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_preprocessed_image(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_temp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+421:         self.img_ref = np.copy(temp)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_temp, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->img_ref, 0);
  __pyx_v_self->img_ref = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+422:         img_fft = np.fft.fftshift(np.fft.fft2(temp))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fftshift); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_fft); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_fft2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_temp, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_img_fft = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
+423:         fft_real = np.real(img_fft).astype(np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_img_fft, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_2};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_fft_real = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+424:         fft_imag = np.imag(img_fft).astype(np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_img_fft, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_2};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 424, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_astype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_fft_imag = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+425:         fft_real[fft_real.shape[0]//2, fft_real.shape[1]//2] = 0
  __pyx_t_12 = ((__pyx_v_fft_real.shape[0]) / 2);
  __pyx_t_13 = ((__pyx_v_fft_real.shape[1]) / 2);
  *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fft_real.data + __pyx_t_12 * __pyx_v_fft_real.strides[0]) ) + __pyx_t_13 * __pyx_v_fft_real.strides[1]) )) = 0.0;
+426:         fft_imag[fft_imag.shape[0]//2, fft_imag.shape[1]//2] = 0
  __pyx_t_13 = ((__pyx_v_fft_imag.shape[0]) / 2);
  __pyx_t_12 = ((__pyx_v_fft_imag.shape[1]) / 2);
  *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fft_imag.data + __pyx_t_13 * __pyx_v_fft_imag.strides[0]) ) + __pyx_t_12 * __pyx_v_fft_imag.strides[1]) )) = 0.0;
+427:         self.d0 = self._compute_d0(fft_real, fft_imag)
  __pyx_t_14 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_compute_d0(__pyx_v_self, __pyx_v_fft_real, __pyx_v_fft_imag); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 427, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->d0, 0);
  __pyx_v_self->d0 = __pyx_t_14;
  __pyx_t_14.memview = NULL;
  __pyx_t_14.data = NULL;
+428:         out = self._get_d_corr_max(self.d0, 0, 1)
  if (unlikely(!__pyx_v_self->d0.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 428, __pyx_L1_error)}
  __pyx_t_14 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_get_d_corr_max(__pyx_v_self, __pyx_v_self->d0, 0.0, 1.0); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 428, __pyx_L1_error)
  __pyx_v_out = __pyx_t_14;
  __pyx_t_14.memview = NULL;
  __pyx_t_14.data = NULL;
+429:         self.kc0 = out[0]
  __pyx_t_12 = 0;
  __pyx_v_self->kc0 = (*((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) )));
+430:         self.a0 = out[1]
  __pyx_t_12 = 1;
  __pyx_v_self->a0 = (*((float *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) )));
+431:         self.d = self._compute_d()
  __pyx_t_6 = ((struct __pyx_vtabstruct_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self->__pyx_vtab)->_compute_d(__pyx_v_self); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 431, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->d, 0);
  __pyx_v_self->d = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 432: 
+433:         self.resolution = 2 * self.pixel_size / self.kc_max
  __pyx_v_self->resolution = ((2.0 * __pyx_v_self->pixel_size) / __pyx_v_self->kc_max);
 434: 
+435:         if self.do_plot:
  if (__pyx_v_self->do_plot) {
/* … */
  }
+436:             self.plot_results()
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_plot_results); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    __pyx_t_5 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[1] = {__pyx_t_2, };
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 437: 
+438:     def plot_results(self):
/* Python wrapper */
static PyObject *__pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_5plot_results(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_4plot_results, "\n        Returns the plot of the results of the analysis as a numpy array\n        ");
static PyMethodDef __pyx_mdef_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_5plot_results = {"plot_results", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_5plot_results, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_4plot_results};
static PyObject *__pyx_pw_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_5plot_results(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plot_results (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args);
  if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 438, __pyx_L3_error)
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) {
    __Pyx_RaiseArgtupleInvalid("plot_results", 1, 0, 0, __pyx_nargs); return NULL;}
  if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "plot_results", 0))) return NULL;
  goto __pyx_L4_argument_unpacking_done;
  goto __pyx_L3_error;
  __pyx_L3_error:;
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis.plot_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_4plot_results(((struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *)__pyx_v_self));
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_4plot_results(struct __pyx_obj_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis *__pyx_v_self) {
  PyObject *__pyx_v_fig = NULL;
  PyObject *__pyx_v_ax = NULL;
  PyObject *__pyx_v_x = NULL;
  Py_ssize_t __pyx_v_k;
  PyObject *__pyx_v_dg = NULL;
  int __pyx_v_j;
  CYTHON_UNUSED PyObject *__pyx_v_kc = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_a_g = NULL;
  PyObject *__pyx_v_buf = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_v_im = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plot_results", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis.plot_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fig);
  __Pyx_XDECREF(__pyx_v_ax);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_dg);
  __Pyx_XDECREF(__pyx_v_kc);
  __Pyx_XDECREF(__pyx_v_a_g);
  __Pyx_XDECREF(__pyx_v_buf);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_im);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__33 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_fig, __pyx_n_s_ax, __pyx_n_s_x, __pyx_n_s_k, __pyx_n_s_dg, __pyx_n_s_j, __pyx_n_s_kc, __pyx_n_s_a_g, __pyx_n_s_buf, __pyx_n_s_data, __pyx_n_s_w, __pyx_n_s_h, __pyx_n_s_im); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
/* … */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7nanopyx_4core_8analysis_6decorr_14DecorrAnalysis_5plot_results, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_DecorrAnalysis_plot_results, NULL, __pyx_n_s_nanopyx_core_analysis_decorr, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis, __pyx_n_s_plot_results, __pyx_t_4) < 0) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  PyType_Modified(__pyx_ptype_7nanopyx_4core_8analysis_6decorr_DecorrAnalysis);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_nanopyx_core_analysis_decorr, __pyx_n_s_plot_results, 438, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 438, __pyx_L1_error)
 439:         """
 440:         Returns the plot of the results of the analysis as a numpy array
 441:         """
+442:         fig, ax = plt.subplots(dpi=150)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_subplots); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dpi, __pyx_int_150) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 442, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 442, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_fig = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_ax = __pyx_t_2;
  __pyx_t_2 = 0;
+443:         x = np.linspace(0.0, 1.0, self.n_r)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_float_0_0, __pyx_float_1_0, __pyx_t_2};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 3+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_v_x = __pyx_t_3;
  __pyx_t_3 = 0;
+444:         for k in range(self.d0.shape[0]):
  if (unlikely(!__pyx_v_self->d0.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 444, __pyx_L1_error)}
  __pyx_t_7 = (__pyx_v_self->d0.shape[0]);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_k = __pyx_t_9;
+445:             x[k] = self.rmin + (self.rmax-self.rmin)*k/(self.n_r-1)
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->rmin + (((__pyx_v_self->rmax - __pyx_v_self->rmin) * __pyx_v_k) / ((float)(__pyx_v_self->n_r - 1))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely((__Pyx_SetItemInt(__pyx_v_x, __pyx_v_k, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0))) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
 446: 
+447:         ax.plot(x, np.array(self.d0), c="k")
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_plot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_v_self->d0.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 447, __pyx_L1_error)}
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_self->d0, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x)) __PYX_ERR(0, 447, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_c, __pyx_n_u_k) < 0) __PYX_ERR(0, 447, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 448: 
+449:         dg = np.zeros((self.n_r))
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_1};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_v_dg = __pyx_t_2;
  __pyx_t_2 = 0;
+450:         for k in range(self.n_g):
  __pyx_t_6 = __pyx_v_self->n_g;
  __pyx_t_11 = __pyx_t_6;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_11; __pyx_t_7+=1) {
    __pyx_v_k = __pyx_t_7;
+451:             for j in range(self.n_r):
    __pyx_t_12 = __pyx_v_self->n_r;
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_j = __pyx_t_14;
+452:                 dg[j] = np.array(self.d[j][k])
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_v_self->d.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 452, __pyx_L1_error)}
      __pyx_t_15 = __pyx_v_j;
      __pyx_t_16 = __pyx_v_k;
      __pyx_t_4 = PyFloat_FromDouble((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->d.data + __pyx_t_15 * __pyx_v_self->d.strides[0]) ) + __pyx_t_16 * __pyx_v_self->d.strides[1]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = NULL;
      __pyx_t_17 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_17 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_17, 1+__pyx_t_17);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (unlikely((__Pyx_SetItemInt(__pyx_v_dg, __pyx_v_j, __pyx_t_2, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0))) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
+453:             plt.plot(x, dg, c="g")
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_plt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_plot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x)) __PYX_ERR(0, 453, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_dg);
    __Pyx_GIVEREF(__pyx_v_dg);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_dg)) __PYX_ERR(0, 453, __pyx_L1_error);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_c, __pyx_n_u_g) < 0) __PYX_ERR(0, 453, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
+454:         for k in range(self.d0.shape[0]):
  if (unlikely(!__pyx_v_self->d0.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 454, __pyx_L1_error)}
  __pyx_t_7 = (__pyx_v_self->d0.shape[0]);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_k = __pyx_t_9;
+455:             x[k] = self.rmin2 + (self.rmax2-self.rmin2)*k/(self.n_r-1)
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->rmin2 + (((__pyx_v_self->rmax2 - __pyx_v_self->rmin2) * __pyx_v_k) / ((float)(__pyx_v_self->n_r - 1))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely((__Pyx_SetItemInt(__pyx_v_x, __pyx_v_k, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0))) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
+456:         for k in range(self.n_g, 2*self.n_g):
  __pyx_t_18 = (2 * __pyx_v_self->n_g);
  __pyx_t_19 = __pyx_t_18;
  for (__pyx_t_7 = __pyx_v_self->n_g; __pyx_t_7 < __pyx_t_19; __pyx_t_7+=1) {
    __pyx_v_k = __pyx_t_7;
+457:             for j in range(self.n_r):
    __pyx_t_6 = __pyx_v_self->n_r;
    __pyx_t_11 = __pyx_t_6;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_j = __pyx_t_12;
+458:                 dg[j] = np.array(self.d[j][k])
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_v_self->d.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 458, __pyx_L1_error)}
      __pyx_t_16 = __pyx_v_j;
      __pyx_t_15 = __pyx_v_k;
      __pyx_t_4 = PyFloat_FromDouble((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->d.data + __pyx_t_16 * __pyx_v_self->d.strides[0]) ) + __pyx_t_15 * __pyx_v_self->d.strides[1]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = NULL;
      __pyx_t_13 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_13 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      if (unlikely((__Pyx_SetItemInt(__pyx_v_dg, __pyx_v_j, __pyx_t_3, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0))) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
+459:             plt.plot(x, dg, c="b")
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_plt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_plot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x)) __PYX_ERR(0, 459, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_dg);
    __Pyx_GIVEREF(__pyx_v_dg);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dg)) __PYX_ERR(0, 459, __pyx_L1_error);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_c, __pyx_n_u_b) < 0) __PYX_ERR(0, 459, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
+460:         kc = np.array(self.kc)
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_v_self->kc.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 460, __pyx_L1_error)}
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_self->kc, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_v_kc = __pyx_t_1;
  __pyx_t_1 = 0;
+461:         a_g = np.array(self.a_g)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_v_self->a_g.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 461, __pyx_L1_error)}
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->a_g, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_v_a_g = __pyx_t_1;
  __pyx_t_1 = 0;
+462:         ax.axvline(x=self.kc_max, color="b", linestyle="-", label="Cut-off frequency")
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_axvline); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->kc_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_x, __pyx_t_3) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_color, __pyx_n_u_b) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_linestyle, __pyx_kp_u__16) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_label, __pyx_kp_u_Cut_off_frequency) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+463:         ax.set_xlabel(f"Normalized frequency")
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_set_xlabel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u_Normalized_frequency};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+464:         ax.set_ylabel("Cross-correlation coefficients")
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_set_ylabel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u_Cross_correlation_coefficients};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+465:         ax.set_title(f"Decorrelation analysis resolution: {np.round(self.resolution, 4)} {self.units}")
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ax, __pyx_n_s_set_title); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = 0;
  __pyx_t_20 = 127;
  __Pyx_INCREF(__pyx_kp_u_Decorrelation_analysis_resolutio);
  __pyx_t_7 += 35;
  __Pyx_GIVEREF(__pyx_kp_u_Decorrelation_analysis_resolutio);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Decorrelation_analysis_resolutio);
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_round); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->resolution); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_22 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_21))) {
    __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_21);
    if (likely(__pyx_t_22)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
      __Pyx_INCREF(__pyx_t_22);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_21, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_22, __pyx_t_10, __pyx_int_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_21, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  }
  __pyx_t_21 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_20 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) > __pyx_t_20) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) : __pyx_t_20;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_21);
  __Pyx_GIVEREF(__pyx_t_21);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_21);
  __pyx_t_21 = 0;
  __Pyx_INCREF(__pyx_kp_u__17);
  __pyx_t_7 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__17);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__17);
  __pyx_t_21 = __Pyx_PyUnicode_Unicode(__pyx_v_self->units); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __pyx_t_20 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) > __pyx_t_20) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_21) : __pyx_t_20;
  __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_21);
  __Pyx_GIVEREF(__pyx_t_21);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_21);
  __pyx_t_21 = 0;
  __pyx_t_21 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_7, __pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_21};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+466:         with io.BytesIO() as buf:
  /*with:*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_io); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_21))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_21);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_21, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[1] = {__pyx_t_4, };
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_21, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
    __pyx_t_23 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_23);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 466, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    __pyx_t_6 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[1] = {__pyx_t_1, };
      __pyx_t_21 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 466, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_21);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_t_4 = __pyx_t_21;
    __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /*try:*/ {
      {
        /*try:*/ {
          __pyx_v_buf = __pyx_t_4;
          __pyx_t_4 = 0;
/* … */
        }
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
        goto __pyx_L26_try_end;
        __pyx_L21_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("nanopyx.core.analysis.decorr.DecorrAnalysis.plot_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 466, __pyx_L23_except_error)
          __Pyx_XGOTREF(__pyx_t_2);
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_3);
          __pyx_t_21 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 466, __pyx_L23_except_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_21, NULL);
          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 466, __pyx_L23_except_error)
          __Pyx_GOTREF(__pyx_t_27);
          __pyx_t_28 = __Pyx_PyObject_IsTrue(__pyx_t_27);
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
          if (__pyx_t_28 < 0) __PYX_ERR(0, 466, __pyx_L23_except_error)
          __pyx_t_29 = (!__pyx_t_28);
          if (unlikely(__pyx_t_29)) {
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_3);
            __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; 
            __PYX_ERR(0, 466, __pyx_L23_except_error)
          }
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L22_exception_handled;
        }
        __pyx_L23_except_error:;
        __Pyx_XGIVEREF(__pyx_t_24);
        __Pyx_XGIVEREF(__pyx_t_25);
        __Pyx_XGIVEREF(__pyx_t_26);
        __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
        goto __pyx_L1_error;
        __pyx_L22_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_24);
        __Pyx_XGIVEREF(__pyx_t_25);
        __Pyx_XGIVEREF(__pyx_t_26);
        __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
        __pyx_L26_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_23) {
          __pyx_t_26 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_tuple__18, NULL);
          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
          if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 466, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_26);
          __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
        }
        goto __pyx_L20;
      }
      __pyx_L20:;
    }
    goto __pyx_L30;
    __pyx_L17_error:;
    __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
    goto __pyx_L1_error;
    __pyx_L30:;
  }
/* … */
  __pyx_tuple__18 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);
+467:             fig.savefig(buf, format="raw", dpi=150)
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fig, __pyx_n_s_savefig); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 467, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_v_buf);
          __Pyx_GIVEREF(__pyx_v_buf);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_buf)) __PYX_ERR(0, 467, __pyx_L21_error);
          __pyx_t_21 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 467, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_21);
          if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_format, __pyx_n_u_raw) < 0) __PYX_ERR(0, 467, __pyx_L21_error)
          if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_dpi, __pyx_int_150) < 0) __PYX_ERR(0, 467, __pyx_L21_error)
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_21); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+468:             buf.seek(0)
          __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_buf, __pyx_n_s_seek); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 468, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_3 = NULL;
          __pyx_t_6 = 0;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_21))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_21);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_21, function);
              __pyx_t_6 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_0};
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_21, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L21_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+469:             data = np.frombuffer(buf.getvalue(), dtype=np.uint8)
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_21);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_buf, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = NULL;
          __pyx_t_6 = 0;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
              __pyx_t_6 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[1] = {__pyx_t_4, };
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L21_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_1);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 469, __pyx_L21_error);
          __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_data = __pyx_t_2;
          __pyx_t_2 = 0;
+470:         w, h = fig.canvas.get_width_height()
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fig, __pyx_n_s_canvas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get_width_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[1] = {__pyx_t_1, };
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 470, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_21 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_21);
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_21); if (unlikely(!__pyx_t_2)) goto __pyx_L31_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_21); if (unlikely(!__pyx_t_1)) goto __pyx_L31_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_21), 2) < 0) __PYX_ERR(0, 470, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    goto __pyx_L32_unpacking_done;
    __pyx_L31_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 470, __pyx_L1_error)
    __pyx_L32_unpacking_done:;
  }
  __pyx_v_w = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_h = __pyx_t_1;
  __pyx_t_1 = 0;
+471:         im = data.reshape((int(h), int(w), -1))
  if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 471, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_reshape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_21 = __Pyx_PyNumber_Int(__pyx_v_w); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_21);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_21)) __PYX_ERR(0, 471, __pyx_L1_error);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_neg_1)) __PYX_ERR(0, 471, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_21 = 0;
  __pyx_t_21 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_21)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_21);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_21, __pyx_t_4};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_v_im = __pyx_t_3;
  __pyx_t_3 = 0;
+472:         plt.close(fig)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_fig};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 473: 
+474:         return im
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_im);
  __pyx_r = __pyx_v_im;
  goto __pyx_L0;